#pragma once
#include <osg/Vec3d>

#include "CmdHandler3.h"

class UCS;
class Ent;
class Spline2D;
class FitCurve2DHandler : public CmdHandler3
{
	Q_OBJECT
public:
	Q_INVOKABLE FitCurve2DHandler();
	~FitCurve2DHandler();

	virtual void input(const QVariant& data, const QString& rawInput, CommandSource cs) override;

protected:
	std::shared_ptr<Spline2D> m_spline;
	std::set<std::shared_ptr<Ent>> m_usedEnts;
	UCS* m_ucs;
};

class LineStrip2D;
class Scene;
class FitPoints2DHandler : public CmdHandler3
{
	Q_OBJECT
public:
	Q_INVOKABLE FitPoints2DHandler();
	~FitPoints2DHandler();

	virtual void input(const QVariant& data, const QString& rawInput, CommandSource cs) override;
	void makeSpline(Scene* scene);

protected:
	std::shared_ptr<LineStrip2D> m_line;
	std::shared_ptr<Spline2D> m_spline;
};
